<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>教师管理页面</title>
	<link rel="stylesheet" href="https://www.jq22.com/jquery/font-awesome.4.7.0.css">
	<link rel="stylesheet" href="/css/bc.grid.min.css"/>
	<link type="text/css" rel="stylesheet" href="/layui/css/layui.css">
	<script src="/js/bc.grid.min.js"></script>
	<script src="/jquery/jquery-3.6.0.js"></script>
	<style type="text/css">
		.title{
			margin: 20px;
		}
		.title h1{
			text-align: center;
		}
		.title a{
			text-decoration: none;
		}
	</style>
</head>
<body>
<div>
	<div id="table"></div>
	<div class="bc-test">
		<button type="button" class="layui-btn" id="modifyselected">修改</button>
		<button type="button" class="layui-btn" id="deleteselected">删除</button>
	</div>
	<div id ="modifyform" style="display: none">
		<form class="layui-form" lay-filter="form" id="form">
			<div class="layui-form-item">
				<label class="layui-form-label">您的姓名</label>
				<div class="layui-input-inline">
					<input type="text" name="username"  class="layui-input"  >
				</div>
			</div>

			<div class="layui-form-item">
				<label class="layui-form-label">修改密码</label>
				<div class="layui-input-inline">
					<input type="password" id="pwd" name="password" placeholder="请输入原密码"  class="layui-input">
				</div>

			</div>

			<div class="layui-form-item">
				<label class="layui-form-label">新密码</label>
				<div class="layui-input-inline">
					<input type="password" name="password2" placeholder="请输入新密码"  class="layui-input" id="pwd2">
				</div>
				<div class="layui-form-mid layui-word-aux" id="msg">请填写6到12位密码</div>
			</div>

			<div class="layui-form-item">
				<label class="layui-form-label">您的电话</label>
				<div class="layui-input-inline">
					<input type="text" name="serialnumber"  class="layui-input" >
				</div>
				<div class="layui-form-mid layui-word-aux" ></div>
			</div>

			<div class="layui-form-item">
				<label class="layui-form-label">您的邮箱</label>
				<div class="layui-input-inline">
					<input type="text" name="mailnumber"  class="layui-input"  >
				</div>
				<div class="layui-form-mid layui-word-aux" ></div>
			</div>

			<div class="layui-form-item">
				<label class="layui-form-label">科目选择</label>
				<div class="layui-input-block">
					<input type="checkbox" >
				</div>
			</div>

			<div class="layui-form-item">
				<div class="layjava
				ui-input-block">
					<button class="layui-btn layui-btn-disabled"  lay-submit="" lay-filter="modifyteacherinfo" id="send" readonly="readonly">立即提交</button>
					<button type="reset" class="layui-btn layui-btn-primary">重置</button>
				</div>
			</div>
		</form>

	</div>
</div>
<script>
	$(function () {
		var grid = BCGrid.create("#table", {
			columns: [
				{id: 'teacherid', name: 'teacherid', display: '教师ID'},
				{id: 'realname', name: 'realname', display: '教师姓名'},
				{name: 'mailnumber', display: '邮箱账号'},
				{name: 'serialnumber', display: '手机号'},
				{name: 'regtime', display: '注册时间', type: 'date', format: 'yyyy MM/dd'},
				{name:'subjects',display:'已选科目'}

			],
			checkboxSelection: true, //设置数据复选框
			showCheckbox: true,
			url: 'adminteacher',
			method:'post',

		});

		$(".bc-test button").on("click",function (e) {
			var id = e.currentTarget.id;
			switch (id){
				case "modifyselected":
					const index = grid.getCheckedRows();
					const data = grid.getRowData(index);
					$('#modifyform').css("display","block");
					$("input[name='username']");
					// $.post({
					// 	url: "/modifyselected",
					// 	data: data,
					// 	type: 'post',
					// 	contentType: 'application/json;charset=utf-8',
					// 	dataType: 'json',
					// 	success: function (response) {
					// 		if (response.success) {
					// 			//parent.location.reload(); //刷新父页面
					// 			console.log("提交完毕")
					// 		} else {
					// 		}
					// 	}
					// });
					break;
				case "deleteselected":
					console.log(grid.getCheckedRows());
					break;
				case "getSelectedRows":
					console.log(grid.getSelectedRows());
					break;
				case "setCheckedRow":
					grid.setCheckedRow(0,true);
					break;
				case "deleteRow":
					grid.deleteRow(0);
					break;
				case "getRowData":
					console.log();
					break;
				case "getCurrentPage":
					alert(grid.getCurrentPage());
					break;
				case "reload":
					grid.reload();
					break;
				case "reloadData":
					grid.reloadData();
					break;
				case "refresh":
					grid.refresh();
					break;
				case "get":
					alert(grid.get("url"));
					break;
				case "set":
					grid.set({title:'I`m BC Grid!'});
					grid.refresh();
					break;
				case "setTitle":
					grid.setTitle('U like me?');
					break;
				case "setFoot":
					grid.setFoot('I like u!');
					break;
				case "deleteRows":
					grid.deleteRows([1,2,3]);
					break;
				case "toggleRowDetail":
					grid.toggleRowDetail(4);
					break;
				case "getData":
					console.log( grid.getData());
					break;
				case "getRawData":
					console.log(grid.getRawData());
					break;


			}
		});
		console.log("%c\n找对地方了！ ", "font-size:41px;color:red;font-weight:bold;");
	});
</script>
</body>
</html>